﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using SWDataDB.Models;
using SWDataDB.BLL;
using SWDataDB.DAL;
using System.Data;
public partial class AdminManage_Edit_YXDesEdit : System.Web.UI.Page
{
    public string zkid = null;
    protected void Page_Load(object sender, EventArgs e)
    {
        zkid = Request["zkid"];
        bind();
    }


    private void bind()
    {


        YXDeepthInfo zkquery = new YXDeepthInfo();
        int ZKID = Convert.ToInt32(zkid);
        DataSet ds = zkquery.SelectInfoByID(ZKID);
        DataRowView dv = ds.Tables[0].DefaultView[0];


        ZK_CODE.Text = Convert.ToString(dv.Row["ZK_CODE"]);
        YX_DESRIBE.InnerText = Convert.ToString(dv.Row["YX_DESRIBE"]);
        CY_DEEP.Text = Convert.ToString(dv.Row["CY_DEEP"]);

       
        ZL_FILE_ID.Text = Convert.ToString(dv.Row["ZL_FILE_ID"]);


        //从著录表中读取title
        ZLInfo ZLFILEID = new ZLInfo();
        ZL_TBL zl = ZLFILEID.SelectZLInfoByID(dv.Row["ZL_FILE_ID"].ToString());
        TITLE_.Text = zl.O_TITLE;
        FileTitle.Text = zl.O_TITLE;
    }


    protected void submit_Click(object sender, EventArgs e)
    {
        YX_DEEPTH_TBL yxobj = new YX_DEEPTH_TBL();
        YXDeepthInfo kc_in = new YXDeepthInfo();

        yxobj.O_ZK_CODE = Request.Form["ZK_CODE"];
        yxobj.O_ZL_FILE_ID = Request.Form["ZL_FILE_ID"];

        yxobj.O_CY_DEEP = Request.Form["CY_DEEP"];

        yxobj.O_YX_DESRIBE = this.YX_DESRIBE.InnerText;
        yxobj.O_ID = int.Parse(zkid);






        if (kc_in.UpdateYXInfo(yxobj) == 1)
        {
            bind();
            Response.Write("<script language=javascript>alert('更新成功！');location='../Manage/YXDesManage.aspx'</script>");
            //Response.Redirect("ZLManage.aspx");
        }
        else
        {
            Response.Write("<script language=javascript>alert('更新失败！');location='../Manage/YXDesManage.aspx'</script>");
        }
    }
}